<?php


namespace App\Repository1;


use mysql_xdevapi\Exception;

class RecentOrderValidator implements OrderValidatorInterface
{

    /**
     * RecentOrderValidator constructor.
     */
    public function __construct(OrderRepository $order)
    {
        $this->order=$order;
    }

    public function validate(Order $order)
    {
        // TODO: Implement validate() method.
        $recent = $this->order->getRecentOrderCount($order->account);
        if ($recent> 0) {
            throw new Exception("error");
        }
    }

}